package com.ilancuo.compare.fun2;

import java.util.ArrayList;
import java.util.Collections;
import java.util.List;

/**
 * 测试类
 * Created by ilancuo on 2018/4/7.
 */
public class Test {

    public static void main(String[] args) {
        List<User> users = new ArrayList<>();
        for (int i = 0; i < 100; i++) {
            User user = new User("user-" + (100 - i));
            users.add(user);
        }

        Collections.sort(users, (o1, o2) -> o1.getName().compareTo(o2.getName()));

        for (User user : users)
            System.out.println(user.getName());
    }
}
